﻿<!DOCTYPE html>
<!--隐患排查内容管理-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>

    <link href="../static/js/vue-treeselect/vue-treeselect.css" rel="stylesheet" />
    <script src="../static/js/vue-treeselect/vue-treeselect.js"></script>
    <style>
        /*.el-dialog__body {
            height: 100% !important;
        }

        .el-dialog.is-fullscreen {
            overflow: hidden !important;
        }*/

        .vue-treeselect__control {
            height: 100%;
            border: none;
            background: none;
        }

        .vue-treeselect__placeholder {
            top: -3px;
        }

        .vue-treeselect__single-value {
            top: -3px;
        }

        /*.demo-table-expand {
            font-size: 0;
        }

            .demo-table-expand label {
                width: 90px;
                color: #99a9bf;
            }

            .demo-table-expand .el-form-item {
                margin-right: 0;
                margin-bottom: 0 !important;
                width: 100%;
                padding-left: 45px;
            }*/

        /*.el-form-item__content span {
            line-height: 40px;
        }*/
    </style>
</head>

<body>

    <div id="app" v-cloak>

        <el-form label-position="right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
                 style="margin-bottom: 15px;">
            <el-row>
                <el-col class="head-tool">
                    <div class="new_title fl"><strong><img src="/static/images/icon1.png" />隐患排查内容管理列表</strong></div>
                    <span>
                        <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="3" @click="onSubmit">
                        </btn>
                        <btn :text="col.btnAdd" linetype="3" @click="UserInput('tj')"></btn>
                        <!--<btn-uploadfile-list url="xxxx" linetype="3"></btn-uploadfile-list>-->
                        <btn-export-list url="/api/YH_ScreeningPlan/Export" :forminline="this.formInline"></btn-export-list>
                        <btn :text="col.btnDelete" linetype="4" @click="onDelete"></btn>
                    </span>
                </el-col>
            </el-row>
            <el-row>
                <list-factorys-all v-model="formInline.model.CreateFactory" @change="factoryChange"></list-factorys-all>
                <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        {{RisksManagement.RiskContent.Unit+mark.m}}
                                    </template>
                                    <treeselect v-model="formInline.model.Unit"
                                                :options="department"
                                                :flat="true"
                                                :show-count="true"
                                                slot="suffix"
                                                style="line-height: 28px;"
                                                placeholder="请选择" />
                                </el-input>
                            </el-form-item>
                        </div>
                </el-col>
                <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.Objective"
                                      :placeholder="RisksManagement.RiskContent.Objective" size="mini">
                                <template slot="prepend">
                                    {{RisksManagement.RiskContent.Objective+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{RisksManagement.RiskContent.PersonInCharge+mark.m}}
                                </template>
                                <tree-department-staff-single slot="suffix" v-model="formInline.model.PersonInCharge"  style="line-height:28px;"></tree-department-staff-single>
                            </el-input>

                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{RisksManagement.RiskContent.Participant+mark.m}}
                                </template>
                                <tree-department-staff-single slot="suffix" v-model="formInline.model.ParticipantID"    style="line-height:28px;"></tree-department-staff-single>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.Content"
                                      :placeholder="RisksManagement.RiskContent.Content" size="mini">
                                <template slot="prepend">
                                    {{RisksManagement.RiskContent.Content+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>


            </el-row>
        </el-form>


        <el-col :span="24">
            <el-table stripe ref="table" :data="ListItem.tableData" :height="ListItem.tableHeight" border
                      @selection-change="handleSelectionChange" row-style="height:10px" style="width: 100%"
                      :expand-row-keys="expands" row-key="id">
                <el-table-column type="selection" align="center" width="55">
                </el-table-column>
                <el-table-column type="expand">
                    <template slot-scope="props">
                        <el-table ref="subtable" :data="props.row.yH_ProjectAndDetail" border>
                            <el-table-column prop="Project" :label="RisksManagement.RiskContent.id" width="50">
                                <template slot-scope="props">
                                    {{props.$index + 1}}
                                </template>
                            </el-table-column>
                            <el-table-column prop="project" :label="RisksManagement.RiskContent.Project">
                            </el-table-column>
                            <el-table-column prop="regionName" :label="RisksManagement.RiskContent.Region">
                            </el-table-column>
                            <el-table-column prop="remark" :label="RisksManagement.RiskContent.Remark">
                            </el-table-column>
                            <el-table-column prop="standardContent" :label="RisksManagement.RiskContent.Standard">
                            </el-table-column>
                            <el-table-column prop="riskLevelText" :label="RisksManagement.RiskContent.RiskLevel">
                            </el-table-column>
                        </el-table>
                    </template>
                </el-table-column>

                <el-table-column type="index" :label="RisksManagement.RiskContent.id" :index="indexMethod" width="50"
                                 show-overflow-tooltip="true"></el-table-column>
                <el-table-column width="103" prop="update" :label="'仅测试用'">
                    <template slot-scope="scope">
                        <button type="button" class="elst-bt-xg" @click=DoJob(scope.row.id)>
                            立即执行
                        </button>
                    </template>
                </el-table-column>
                <el-table-column prop="sysDepartment.name" :label="RisksManagement.RiskContent.Unit" show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="objective" :label="RisksManagement.RiskContent.Objective"
                                 show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="personInChargeText" show-overflow-tooltip="true" width="150"
                                 :label="RisksManagement.RiskContent.PersonInCharge">
                </el-table-column>
                <el-table-column prop="participant" show-overflow-tooltip="true" width="150"
                                 :label="RisksManagement.RiskContent.Participant">
                </el-table-column>
                <el-table-column prop="requirements" :label="RisksManagement.RiskContent.Requirements" min-width="150" show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="content" :label="RisksManagement.RiskContent.Content" min-width="150"
                                 show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="standardTypeText" :label="RisksManagement.RiskContent.StandardType" min-width="150"
                                 show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="investigationPostName" :label="RisksManagement.RiskContent.InvestigationPost"
                                 min-width="150" show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="screeningType" :label="RisksManagement.RiskContent.DailyAndPlan" min-width="150"
                                 show-overflow-tooltip="true">
                </el-table-column>


                <el-table-column prop="frequencyText" :label="RisksManagement.RiskContent.Frequency" min-width="150"
                                 show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column width="53" prop="update" :label="col.btnUpdate" fixed="right">
                    <template slot-scope="scope">
                        <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.id)>
                            <i class="el-icon-edit"></i>
                        </button>
                    </template>
                </el-table-column>
            </el-table>
            <el-row type="flex" justify="end">


                <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                               :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
                               :layout="ListItem.layout" :total="ListItem.total">
                </el-pagination>

            </el-row>
        </el-col>
        <el-dialog title="隐患排查内容管理"  fullscreen="true" :visible.sync="ListItem.dialogVisible" @close='closeDialog'
                   width="80%" height="80%"  top="10vh">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
        <!--:fullscreen="true"-->
    </div>
    <script type="text/javascript">
        Vue.component('treeselect', VueTreeselect.Treeselect)
        app = new Vue({
            el: '#app',
            data: function () {
                return {
                    department: [],
                    expands: [],
                    defaultProps: {
                        children: 'children',
                        label: 'label'
                    },
                    //Region: myTree,
                    Region: [],
                    //页面内数据初始化
                    ListItem: ListItem,
                    formInline: {
                        model: {
                            CreateFactory: null,
                            Unit: null,
                            Objective: '',
                            PersonInCharge: null,
                            ParticipantID: null,
                            Content: ''
                        },
                        offset: 0,
                        limit: 10
                    },
                    PersonInCharge: [],
                }
            },
            mounted: function () {
               //this.getDepartmentData();
               // //初始化数据
               // this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                //立即执行
                DoJob: function (id) {
                    console.log(id);
                    //myAjax("get", this, '/api/YH_ScreeningPlanTask/DoAJob?id=' + id, null, function (response) {
                    //    var ajaxModel = response.data;
                    //    console.log(ajaxModel);
                    //    if (ajaxModel > 0) {
                    //        showMessage(msg.OperatingOk, 'success');
                    //    }
                    //    else {
                    //        showMessage('执行失败', 'error');
                    //    }
                    //}, false);
                },
                factoryChange: function () {
                    this.getDepartmentData();
                    this.GetPageData(1);
                },
                //表格序号连续化
                indexMethod: function (index) { return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1; },

                closeDialog: function () { closeDialog(this); },
                //删除方法
                onDelete: function () { onDelete(this, '/api/YH_ScreeningPlan/DeleteMuti'); },
                //列表选择触发
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //Dialog展示
                UserInput: function (val, id) {
                    DialogShow(this, val, "RiskContentInput.html", id);
                },
                //获取分页数据
                GetPageData: function (currentIndex) {
                    GetPageData(this, currentIndex, '/api/YH_ScreeningPlan/GetList')
                },
                //查询方法
                onSubmit: function () { onSubmit(this); },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },
                  //初始化部门下拉树
                getDepartmentData: function () {
                    var mythis = this;
                    myAjax("post", this, '/api/SysDepartment/GetList', { model: { Name: '', Code: '', CreateFactory: mythis.formInline.model.CreateFactory }, offset: 0, limit: 999 }, function (response) {
                        mythis.department = menuHelperX(response.data.pageData, guidEmpty)
                    }, false);
                },
            }
        });
        //下拉树数据格式化
        function menuHelperX(list, pid) {
            var result = [];
            if (list.length <= 0)
                return list;
            list.forEach(function (v, i) {
                var temp = {};
                for (var key in v) {
                    temp[key] = v[key];
                }
                temp.label = v.name;
                temp.parentId = temp.parentId ? temp.parentId : guidEmpty;
                var obj;
                if (temp.parentId == pid) {
                    obj = temp;
                    var nextObj = menuHelperX(list, temp.id);
                    if (nextObj.length > 0) {
                        obj.children = nextObj;
                    }
                }
                if (obj)
                    result.push(obj)
            })
            return result;
        }
    </script>
</body>

</html>